package com.util.concurrent.executor;

import org.junit.Test;

import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

public class ExecutorDemo {

    /**
     * 这种写法很奇怪， 相当与()->ff(a,b) 直接实现了runable接口，但是使用 (a,b)->a-b 这种写法，编译错误
     */
    @Test
    public void test01(){
        Executor e = new Executor() {
            @Override
            public void execute(Runnable command) {
                command.run();
                System.out.println("aaaaaaaaaaaa");
            }
        };
        int a = 0;
        int b = 6;
        e.execute(()->ff(a,b));
    }

    void ff(int a,int b){
        System.out.println(a-b);
    }
}
